package com.lightsaber.cut.func;

import java.util.List;

import com.lightsaber.cut.entity.ComponentPool;
import com.lightsaber.cut.entity.Original;

/**
 * @author jliu
 * 
 */
public class Point {
    private int x;
    private int y;

    /**
     * 该方案下的切割整料
     */
    private List<Original> originals = null;

    /**
     * 余料
     */
    private ComponentPool lastPool = null;

    public Point(int x, int y) {
        super();
        this.x = x;
        this.y = y;
    }

    public Point(int x, int y, ComponentPool lastPool, List<Original> originals) {
        super();
        this.x = x;
        this.y = y;
        this.originals = originals;
        this.lastPool = lastPool;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public List<Original> getOriginals() {
        return originals;
    }

    public void setOriginals(List<Original> originals) {
        this.originals = originals;
    }

    public ComponentPool getLastPool() {
        return lastPool;
    }

    public void setLastPool(ComponentPool lastPool) {
        this.lastPool = lastPool;
    }

    public String toStringXY() {
        return String.format("(%d, %d)", x, y);
    }

    @Override
    public String toString() {

        StringBuilder sb = new StringBuilder();
        sb.append(String.format("方案:(%d, %d)\r\n", x, y));

        for (int i = 0; i < originals.size(); i++) {
            sb.append(originals.get(i).toString());
        }

        sb.append(lastPool.toString());

        return sb.toString();
    }

}
